package Gather.CollectionLearn.Collection集合;

import java.util.Objects;

public class Student {
    private String nam;
    private int age;


    public Student() {
    }

    public Student(String nam, int age) {
        this.nam = nam;
        this.age = age;
    }

    /**
     * 获取
     * @return nam
     */
    public String getNam() {
        return nam;
    }

    /**
     * 设置
     * @param nam
     */
    public void setNam(String nam) {
        this.nam = nam;
    }

    /**
     * 获取
     * @return age
     */
    public int getAge() {
        return age;
    }

    /**
     * 设置
     * @param age
     */
    public void setAge(int age) {
        this.age = age;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Student student = (Student) o;
        return age == student.age &&
                Objects.equals(nam, student.nam);
    }

//    @Override
//    public int hashCode() {
//        return Objects.hash(nam, age);
//    }

    public String toString() {
        return "Student{nam = " + nam + ", age = " + age + "}";
    }
}
